package com.xc.pattern.strategy;

/**
 * @author xingchen
 * @description 折扣
 * @create 2022-09-04 20:08
 */
public class DiscountActivity extends Strategy {

    /**
     * 具体的折扣
     */
    private double rate;

    public DiscountActivity(double rate) {
        this.rate = rate;
    }

    @Override
    public double computePrice(ProductOrder productOrder) {

        //一系列复杂的计算  此处省略
        return productOrder.getOldPrice() * rate;

    }
}
